package ru.myrtle.umf.util;

import ru.myrtle.umf.UObject;
import ru.myrtle.umf.UReference;

public class UObjectContainmentList<T extends UObject> extends UObjectList<T> {

    private final UObject owner;
    private final UReference feature;

    /*
     *
     */

    public UObjectContainmentList(UObject owner, UReference feature) {
        this.owner = owner;
        this.feature = feature;
    }

    /*
     *
     */

    @Override
    protected void objectAdded(UObject uObject) {
        uObject.uInternalAttach(owner, feature);
    }

    @Override
    protected void objectRemoved(UObject uObject) {
        uObject.uInternalDetach();
    }
}
